home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / CompareDirs / CompareDirs.rexx
OS/2 REXX Batch file  |  1996-06-22  |  1KB  |  64 lines

  1. /*
  2. ** CompareWindows.rexx
  3. **
  4. ** written by Miloslaw Smyk  <smykm@felix.univ.szczecin.pl>
  5. **
  6. ** $VER 1.02
  7. **
  8. ** This command is similar to Norton Commander's "Compare Directories"
  9. ** and can be invoked by a hot-key in Directory Opus.
  10. **
  11. ** Different entries will be selected in active window, all the other
  12. ** will become deselected. Final message (on title bar) shows:
  13. ** number_different_entries / total_entries_in_window
  14. **
  15. ** © 1994 W.F.M.H.
  16. */
  17.  
  18. OPTIONS RESULTS
  19.  
  20. NL = '0A'X
  21.  
  22. DOPUSToFront
  23.  
  24. Status 3     /* get number of the active window */
  25. ActWin=result
  26. DctWin=1-ActWin
  27.  
  28. GetAll '"/"' ActWin
  29. window1 ="/" || UPPER(RESULT) || "/"
  30.  
  31. GetAll '"/"' DctWin
  32. window2="/" || UPPER(RESULT) || "/"
  33.  
  34.  
  35. WordStart = 1
  36. WordEnd   = 2
  37. idx  = 0
  38. diff = 0
  39.  
  40. Status 6 ActWin /* how many files in the active window */
  41. iter = RESULT
  42.  
  43. TopText 'Comparing windows...'
  44.  
  45. DO iter
  46.     WordEnd=POS('/', window1, WordEnd);
  47.     name = SUBSTR(window1, WordStart, WordEnd-WordStart+1)
  48.     IF index(window2, name) = 0 THEN
  49.         DO
  50.          SelectEntry idx 1
  51.          diff=diff+1
  52.         END
  53.     ELSE
  54.          SelectEntry idx 0
  55.          
  56.     WordStart=WordEnd
  57.     WordEnd=WordEnd+1
  58.     idx=idx+1
  59. END
  60.  
  61. TopText diff || '/' || idx || ' different entries.'
  62.  
  63. DisplayDir ActWin
  64.